You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@swc/core

Package Overview
Dependencies
Maintainers
2
Versions
636
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swc/core

Super-fast alternative for babel


Version published
Weekly downloads
7.1M
increased by0.84%
Maintainers
2
Created
Weekly downloads
 

Package description

What is @swc/core?

The @swc/core package is a super-fast compiler written in Rust that allows for transforming ECMAScript 2015+ code into a backwards compatible version of JavaScript that can be run in older browsers or environments. It is designed to be highly performant and offers features such as transpilation, minification, and source maps generation.

What are @swc/core's main functionalities?

JavaScript/TypeScript Transpilation

Transpiles TypeScript or modern JavaScript to a specified ECMAScript target version. This example demonstrates transpiling TypeScript code to ES5.

require('@swc/core').transformSync('const x: number = 1;', { jsc: { parser: { syntax: 'typescript' }, target: 'es5' } });

Code Minification

Minifies JavaScript code to reduce file size, which is beneficial for production environments. This example shows how to minify a simple expression.

require('@swc/core').transformSync('const x = 1 + 2;', { minify: true });

Source Maps

Generates source maps for the transformed code, aiding in debugging by mapping the transformed code back to the original source code. This example demonstrates generating a source map for a file named 'input.js'.

require('@swc/core').transformFileSync('input.js', { sourceMaps: true });

Other packages similar to @swc/core

Changelog

Source

[1.7.3] - 2024-07-27

Bug Fixes

  • (es/decorators) Fix TypeScript syntax assertion (#9336) (acb3952)

Keywords

FAQs

Package last updated on 27 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc